<?php
/**
 * This is the main Web application configuration. The configuration is properties of 
 * the running CWebApplication instance.
 * @package   config
 * @since     1.0
 * @filesource
 */
return array(
	// website base path. see CApplication::basePath
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	// name of the website. see CApplication::name
	'name'=>'Neural Diagnostics',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	// application components
	'components'=>array(
		// configuration for http request. see CHttpRequest
		'request'=>array(
			// enable CSRF (Cross-Site Request Forgery) validation. 
			// see CHttpRequest::enableCsrfValidation
			// Will be disabled when it is upload request by UploadController
			//'enableCsrfValidation'=>!isset($_SERVER['HTTP_XUPLOAD']),
			// see CHttpRequest::enableCookieValidation
			'enableCookieValidation'=>true,
        ),
        // configuration for web user component. see CWebUser
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		// database connection. see CDbConnection 
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=signaldb',
			'emulatePrepare' => true,
			'username' => 'signaldb',
			'password' => 'a0o^vSn3w|Q',
			'charset' => 'utf8',
			'tablePrefix'=> 'neur_',
		),
		// session management. see CDbHttpSession
		'session' => array(
			'class' => 'CDbHttpSession',
			'connectionID' => 'db',
			'sessionTableName'=>'neur_active_session',
			// disable auto create table for performance
			'autoCreateSessionTable' => false,
			// session time out in seconds
			'timeout'=>3600*2,
		),
		// authentication component. see CDbAuthManager
		'authManager'=>array(
			'class'=>'CDbAuthManager',
		 	'connectionID'=>'db',
			'itemTable'=>'neur_auth_item',
			'itemChildTable'=>'neur_auth_item_child',
			'assignmentTable'=>'neur_auth_assignment',
        	'defaultRoles'=>array(
        		'academic',
			),
		),
		// default configurations for widgets used in Forms
		'widgetFactory'=>array(
		      'widgets'=>array(
		            'EJuiDateTimePicker'=>array(
		            		'options'=>array(
								'dateFormat' =>'yy-mm-dd',
								'timeFormat' => 'hh:mm',
								'showAnim'=>'fold',
								'changeMonth'=>true,
								'changeYear'=>true,
								'showOtherMonths'=>true,
						        'hourGrid' => 4,
								'minuteGrid' =>10,
								'altFieldTimeOnly'=>false,
								'maxDate'=>0,
								'yearRange'=>'1900:c',
							),
							'htmlOptions'=>array(
						        'readonly'=>'readonly',
								'class'=>'calendar',
						    ),
		             ),
		             'CJuiDatePicker'=>array(
		            		'options'=>array(
								'dateFormat' =>'yy-mm-dd',
								'altFormat'=>'yy-mm-dd',
								'showAnim'=>'fold',
								'changeMonth'=>true,
								'changeYear'=>true,
								'showOtherMonths'=>true,
								'maxDate'=>0,
								'yearRange'=>'1900:c',
							),
							'htmlOptions'=>array(
						        'readonly'=>'readonly',
								'class'=>'calendar',
						    ),
		             ),
		       ),
		),
		// error handler. see CErrorHandler
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
        // define properties for CLogRouter for logging
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					// log 'error' and 'warning' in protected/runtime/application.log
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
					'logFile'=>'application.log',
				),
			),
		),
		
		// define the format of date and datetime for displaying.
		'format'=>array(
			'datetimeFormat' => 'Y-m-d H:i:s',
			'dateFormat' => 'Y-m-d',
		),
	),
);